package Operation;
import Books.Book;
import Books.Booklist;

import java.util.Scanner;

public class Findbook implements IOPeration{
    @Override
    public void work(Booklist booklist) {
        System.out.println("查找图书");
        System.out.println("请输入你要查找的图书名称");
        Scanner scanner=new Scanner(System.in);
        String name= scanner.nextLine();
        int usersize=booklist.getUsersize();
        for(int i=0;i<usersize;i++){
            Book book=booklist.getbook(i);
            if(book.getBname().equals(name)){
                System.out.println("已找到该书籍，以下是该书籍的信息");
                System.out.println(book);
                return;
            }
        }
        System.out.println("没有找到该书籍");

    }
}
